package com.cn.date.exercise;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateExercise {
    public static void main(String[] args) throws ParseException {
        //method1();
        //method2();
        Date date = new Date(1000);
        System.out.println(date);

    }

    private static void method2() throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
        Date date = new Date();
        String formatDate = simpleDateFormat.format(date);
        System.out.println(formatDate);
        //2025年01月27日 16:21:09
        String testDate = "2025年01月27日 16:21:09";
        Date parseDate = simpleDateFormat.parse(testDate);
        System.out.println(parseDate);
    }

    private static void method1() {
        Date date = new Date();
        long time = date.getTime();
        System.out.println(time);
        //Thu Jan 01 09:00:00 CST 1970
        Date date1 = new Date(1000*60*60);
        System.out.println(date1);
        date1.setTime(1000);
        System.out.println(date1);
    }
}
